package com.wuwangfu.sink;

import org.apache.flink.api.common.serialization.SimpleStringSchema;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @Author jcshen
 * @Date 2023-02-21
 * @PackageName:com.wuwangfu.sink
 * @ClassName: DPrintSink
 * @Description: TODO
 * @Version 1.0
 *
 * 将数据写入Kafka
 *
 */
public class DWriteSocketSink {
    public static void main(String[] args) throws Exception {
        Configuration config = new Configuration();
        StreamExecutionEnvironment env = StreamExecutionEnvironment.createLocalEnvironmentWithWebUI(config);

        DataStreamSource<String> line = env.socketTextStream("localhost", 8888);
        System.out.println(line.getParallelism());

        line.writeToSocket("localhost", 9999, new SimpleStringSchema());

        env.execute();
    }


}
